package com.langgan.model_main;

import android.view.View;
import androidx.lifecycle.Observer;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.langgan.base.ARouterManager;
import com.langgan.base.mybase.BaseMvvmActivity;
import com.langgan.common.utils.SpUtils;
import com.langgan.model_main.databinding.ActivityMainBinding;
import com.langgan.model_main.mvvm.model.DxModel;
import com.langgan.model_main.mvvm.viewmodel.MainVm;

@Route(path = ARouterManager.GO_MAINACT)
public class MainActivity extends BaseMvvmActivity<MainVm,ActivityMainBinding> {



    @Override
    protected void afterCreate() {
        mViewModel.getData();
        mViewModel.mData.observe(this, new Observer<DxModel>() {
            @Override
            public void onChanged(DxModel dxModel) {

            }
        });
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_main;
    }

    public void goLoginAct(View view) {
        SpUtils.encode("xbc","hahahaha");
        ARouter.getInstance().build(ARouterManager.GO_LOGINACT).navigation();
    }

    public void goLoginAct2(View view) {
        ARouter.getInstance().build(ARouterManager.GO_LOGINACT).withString("msg","我不会写SDK啊").navigation();

    }

}